package com.zr.d_c.serviceimpl;

import java.util.List;

import com.zr.d_c.dao.BookDao;
import com.zr.d_c.daoimpl.BookDaoImpl;
import com.zr.d_c.model.Dish;
import com.zr.d_c.model.Seller;
import com.zr.d_c.service.BookService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * 实现预定service
 * @author 王朝
 *
 */
public class BookServiceImpl implements BookService{

	BookDao bd = new BookDaoImpl();
	@Override
	public List<Seller> getSeller(int start,int pagesize) {
		// TODO Auto-generated method stub
		return bd.selectSeller(start, pagesize);
	}

	@Override
	public List<Seller> getSeller(int start,int pagesize,String sname) {
		// TODO Auto-generated method stub
		return bd.selectSeller(start, pagesize, sname);
	}

	@Override
	public List<Dish> getDish(int start,int pagesize,int sid) {
		// TODO Auto-generated method stub
		return bd.selectDish(start, pagesize, sid);
	}

	@Override
	public List<Dish> getDish(int start,int pagesize,int sid, String dname) {
		// TODO Auto-generated method stub
		return bd.selectDish(start, pagesize, sid, dname);
	}

	@Override
	public int addDishToBuycart(int did, int uid, int bnum) {
		// TODO Auto-generated method stub
		int cid = bd.selectCidByUid(uid);
		return bd.insertDishToBuycart(did, cid, bnum);
	}

	@Override
	public int modDishInByucart(int did,int totalbnum) {
		// TODO Auto-generated method stub
		return bd.updateBuycartDishByDid(did, totalbnum);
	}

}
